博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
完成个人中心—导航标签
阅读量:7051 次
发布时间:2019-06-28

本文共 1170 字,大约阅读时间需要 3 分钟。

个人中心—视图函数带标签页面参数tag

@app.route('/usercenter/<user_id>/<tag>')
def usercenter(user_id, tag):
   if tag == ‘1':
       return render_template('usercenter1.html', **context)

@app.route('/usercenter/
/
')@loginFirstdef usercenter(user_id,tag): user = User.query.filter(User.id == user_id).first() context = { 'username':user.username, 'questions':user.questions, 'comments':user.comments } if tag =='question': return render_template('user question.html',**context) elif tag =='comment': return render_template('user comment.html', **context) else: return render_template('user information.html', **context)

个人中心—导航标签链接增加tag参数

<li role=“presentation”><a href=“{
{ url_for(‘usercenter’,user_id = user.id,tag = ‘1’) }}">全部问答</a></li>

个人中心—有链接到个人中心页面的url增加tag参数

u <a href="{
{ url_for('usercenter',user_id = session.get('userid'), tag=1) }}">{
{ session.get('user') }}</a>

 

转载于:https://www.cnblogs.com/951111ldj/p/8042607.html

你可能感兴趣的文章
SQL中EXISTS的用法
查看>>
基于虚拟用户的邮件系统配置
查看>>
阿修罗监控与grafana结合使用
查看>>
我的友情链接
查看>>
JDK 和JRE的区别
查看>>
lanhelper
查看>>
PLSQL中的内存表--Index By Table
查看>>
Shell练习(十二)
查看>>
解决springmvc+mybatis+mysql中文乱码问题【转】
查看>>
十三,十四单元总结
查看>>
表单布局
查看>>
Centos 6.6 下 nginx +php mysql + phpMyadmin 安装部署
查看>>
device-mapper 块级重删(dm dedup) <3>代码结构(2)
查看>>
cas_client之AuthenticationFilter源码分析
查看>>
脉冲云之持续集成(上篇)
查看>>
Linux LVM硬盘管理及LVM扩容
查看>>
如何进行大数据入门的学习
查看>>
四个核心技术构成智能语音系统
查看>>
Oracle技术之Toad使用技巧
查看>>
C# 如何更改Word语言设置
查看>>